from rest_framework import serializers
from apps.basic.environment.models import EnvironmentModel
from utils.common import date_format


class EnvironmentModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = EnvironmentModel
        exclude = ["is_delete", "update_time"]
        extra_kwargs = {
            "create_time": {
                "read_only": True,
                "format": date_format()
            },
            "is_delete": {
                "required": False
            }
        }


class EnvironmentNamesModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = EnvironmentModel
        fields = ["id", "name"]
